package com.yitongmao.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.yitongmao.bean.SearchReMenBean;
import com.yitongmao.yitmfruit.R;
import java.util.List;

/*
* 作者：梁伟航 on 2017/7/17 14:40
* 类的用途：
*/
public class MyGridViewReMenSouSuoAdapter extends BaseAdapter{
    private Context context;
    private List<SearchReMenBean.SearchLableListBean> searchLableList;
    public MyGridViewReMenSouSuoAdapter(Context context, List<SearchReMenBean.SearchLableListBean> searchLableList) {
        this.context=context;
        this.searchLableList=searchLableList;
    }
    @Override
    public int getCount() {
        return searchLableList.size();
    }

    @Override
    public Object getItem(int position) {
        return searchLableList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView = View.inflate(context, R.layout.historysearchgridviewitem, null);
            viewHolder.mHistorySearchGridTextView =  (TextView) convertView.findViewById(R.id.mHistorySearchGridTextView);
            convertView.setTag(viewHolder);//绑定ViewHolder对象
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.mHistorySearchGridTextView.setText(searchLableList.get(position).lableName);
        return convertView;
    }
    class ViewHolder {
        public TextView mHistorySearchGridTextView;
    }

}
